﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:uc="clr-namespace:FileExplorer.WPF.UserControls"
    xmlns:bc="clr-namespace:FileExplorer.WPF.BaseControls"
    xmlns:localDef="clr-namespace:FileExplorer.WPF.Defines"
    xmlns:def="http://www.quickzip.org/Defines"
    xmlns:cali ="http://www.caliburnproject.org"
    >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Default/Brushes.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/Converters.xaml" />
    </ResourceDictionary.MergedDictionaries>
    
    <ControlTemplate x:Key="InactiveListViewItem" TargetType="ListViewItem">
        <Grid>
            <Rectangle x:Name="ContentBackground" Fill="Transparent" Opacity="0.5"/>
            <ContentPresenter  Margin="2"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
        </Grid>
    </ControlTemplate>



    <ControlTemplate x:Key="lbControlTemplate" TargetType="uc:ListViewItemEx">
        <Border Name="Border"  SnapsToDevicePixels="true"                             
                            BorderThickness="1"
                            BorderBrush="Transparent"
                            Background="Transparent">
            <Grid>
               
                <bc:HotTrack IsEnabled="{TemplateBinding IsEnabled}" 
                         IsDragging="{Binding Path=(def:UIEventHubProperties.IsSelecting), RelativeSource={RelativeSource TemplatedParent} }"
                         IsDraggingOver="{Binding Path=(def:UIEventHubProperties.IsDraggingOver), RelativeSource={RelativeSource TemplatedParent} }"
                         IsSelected="{TemplateBinding IsSelected}"                           
                         >
                    <Grid>
                        <Rectangle x:Name="ContentBackground" Fill="Transparent" Opacity="0.5"/>
                        <ContentPresenter  Margin="2"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Grid>
                </bc:HotTrack>
                <CheckBox IsChecked="{Binding IsSelected}" 
                          Visibility="{Binding IsCheckBoxVisible, 
                                            RelativeSource={RelativeSource AncestorType={x:Type uc:ListViewEx}},
                                            Converter={StaticResource btvc}}"
                          DockPanel.Dock="Left" />
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <!--<Trigger Property="uc:SelectionHelper.IsDragging" Value="true">
                <Setter TargetName="ContentBackground" Property="Fill" Value="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}"/>
                <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.InactiveBorderBrushKey}}"/>
            </Trigger>-->
            <!--<Trigger Property="IsSelected" Value="true">
                <Setter TargetName="ContentBackground" Property="Fill" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"/>
            </Trigger>-->
            <!--<EventTrigger RoutedEvent="FrameworkElement.Loaded">
                            <BeginStoryboard>
                                <Storyboard Storyboard.Target="{Binding}">
                                    <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0.5" To="1" Duration="0:0:1" />
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>-->
        </ControlTemplate.Triggers>
    </ControlTemplate>


    <Style x:Key="ItemContainerStyleBase" TargetType="{x:Type uc:ListViewItemEx}"  >
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        
        <!-- Bind to ViewModel -->
        <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
    </Style>

    <!--BasedOn="{StaticResource AeroGridViewItemContainerStyleKey}"-->
    <Style x:Key="FileListItemStyle_Grid" TargetType="{x:Type ListViewItem}" 
           >
        <!-- Bind to ViewModel -->
        <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
        <Setter Property="BorderThickness" Value="1" />
         <Setter Property="def:UIEventHubProperties.IsSelecting" Value="{Binding IsSelecting}" />
        <Setter Property="def:UIEventHubProperties.IsDraggingOver" Value="{Binding DropHelper.IsDraggingOver}" />
        <Style.Triggers>
            <Trigger Property="def:UIEventHubProperties.IsSelecting" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
            </Trigger>
        </Style.Triggers>
    </Style>


    <Style x:Key="FileListItemStyle" TargetType="{x:Type uc:ListViewItemEx}" BasedOn="{StaticResource ItemContainerStyleBase}" >
        <Setter Property="Template" Value="{StaticResource lbControlTemplate}" />
        <Setter Property="def:UIEventHubProperties.IsSelecting" Value="{Binding IsSelecting, Mode=OneWay}" />
        <Setter Property="def:UIEventHubProperties.IsDraggingOver" Value="{Binding DropHelper.IsDraggingOver, Mode=OneWay}" />
    </Style>

</ResourceDictionary>